package com.yao.spider.yiyao.dao;

import com.yao.spider.yiyao.bean.YaoYuanWang;
import com.yao.spider.yiyao.mapper.YaoYuanWangMapper;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class YaoYuanWangDaoImpl implements YaoYuanWangDao{
    public int insert(YaoYuanWang personInfo, SqlSession session) {
        YaoYuanWangMapper mapper = session.getMapper(YaoYuanWangMapper.class);
        mapper.insert(personInfo);
        session.commit();
        return 1;
    }

    public int batchInsert(List<YaoYuanWang> list, SqlSession session) {
        YaoYuanWangMapper mapper = session.getMapper(YaoYuanWangMapper.class);
        mapper.insertBatch(list);
        session.commit();
        return 1;
    }

    public List<YaoYuanWang> selectUrlIsNull(SqlSession session) {
        YaoYuanWangMapper mapper = session.getMapper(YaoYuanWangMapper.class);
        return mapper.selectUrlIsNull();
    }

    public void updateShiY(Integer id, String shiY, SqlSession sqlSession) {
        YaoYuanWangMapper mapper = sqlSession.getMapper(YaoYuanWangMapper.class);
        mapper.updateShiY(id, shiY);
        sqlSession.commit();
    }

    public YaoYuanWang selectByApplyNo(SqlSession sqlSession, String applyNo) {
        YaoYuanWangMapper mapper = sqlSession.getMapper(YaoYuanWangMapper.class);
        YaoYuanWang yaoYuanWang = mapper.selectByApplyNo(applyNo);
        return yaoYuanWang;
    }

    public YaoYuanWang selectByName(SqlSession sqlSession, String medicineName) {
        YaoYuanWangMapper mapper = sqlSession.getMapper(YaoYuanWangMapper.class);
        YaoYuanWang yaoYuanWang = mapper.selectByName(medicineName);
        return yaoYuanWang;
    }

}
